export class Encoding {

  codePage:number;
  codePageName:string;
  private static defaultEncoding:Encoding|null;

  //默认创建utf-8 encoding.
  static get Default() {
    if(!Encoding.defaultEncoding) {
      Encoding.defaultEncoding = new Encoding("utf-8");
    }
    return Encoding.defaultEncoding;
  }

  constructor(codePageName:string) {
    this.codePageName = codePageName;
  }


  /**
   * 返回和codePage名称相关的Encoding.
   * @returns
   */
  static getEncoding(codePageName:string):Encoding {
    return new Encoding(codePageName);
  }
  get IsSingleByte() {
    return false;
  }
}